class Solution:
    def twoSum(self, nums, target):
        lens = len(nums)
        i = j = -1
        for j in range(1, lens):  # 从第二个数开始找,跳过了第一个数
            num1 = target - nums[j]  # 第二个目标数
            before = nums[:j]  # 临时数组,从目标值前面开始找
            if (num1) in before:  # 如果目标值在前面的数组中,此时,实际上第二个数的索引已经找到了
                i = before.index(num1)
                break
        if i >= 0:
            return [i, j]


nums = [2, 5, 5, 11]
target = 10

solution = Solution()
print(solution.twoSum(nums, target))
